home *** CD-ROM | disk | FTP | other *** search
- 10 rem define macros by robert rockefeller
- 20 print"[147] define macros ":print
- 30 print
- 40 print" refer to the documentation for the "
- 50 print" instructions for using this program."
- 60 print:print" press any key to continue"
- 70 geta$:if a$=""then 70
- 90 dim flag%(51) : rem flag array indicates if a certain macro is defined
- 100 dim macro$(51) : rem holds macro strings
- 110 m1$="this character has been used. would you like to select another (y/n)?"
- 120 m2$="how many characters will be in the"
- 130 m2$=m2$+" macro string represented by this character ? "
- 140 a=780 : x=781 : y=782 : rem sys registers
- 180 rem select macro character
- 200 print"[147]select a macro character."
- 210 gosub 1130
- 230 if a$<>"*" then 300
- 240 print"which macro definition do you wish to cancel ?"
- 250 gosub 1130
- 260 if a$="*" then 240
- 270 flag%(macnum)=0 : rem cancel def
- 280 goto 470
- 300 if flag%(macnum)<>0 then print m1$ : input b$ : if left$(b$,1)="y" then 200
- 320 flag%(macnum)=1
- 330 macro$(macnum)=""
- 370 rem define macro string
- 390 printm2$: input count
- 400 if count>20 then 390
- 420 for loop=1 to count
- 430 input"decimal value ";dec
- 440 macro$(macnum)=macro$(macnum)+chr$(dec)
- 450 next loop
- 470 input"finished all definitions (y/n) ";b$
- 480 if left$(b$,1)<>"y" then 200
- 520 rem create macro table
- 540 ptr=4*4096 : rem create macro table at this address
- 550 for entry=0 to 51
- 560 if flag%(entry)=0 then 750
- 580 rem convert to reversed screen code value
- 590 if entry<26 then code=entry+1+128
- 600 if entry>25 then code= entry+39+128
- 620 poke ptr,code : rem 1st byte of 1 macro entry is screen code value
- 630 ptr=ptr+1 : rem next table byte
- 650 poke ptr,len(macro$(entry))+2 : rem 2nd byte is entry length
- 660 ptr=ptr+1 : rem next table byte
- 680 for iloop=1 to len(macro$(entry)) : rem rest of 1 entry is macro string
- 690 poke ptr,asc(mid$(macro$(entry),iloop,1))
- 700 ptr=ptr+1
- 710 next iloop
- 730 if ptr=>4*4096+500 then print"macro table too large !!!" : stop
- 750 next entry
- 790 rem save macro table
- 820 print"[147]8 - disk
- 830 [153]"9 - disk
- 840 input"save to device number ";dev
- 850 if dev<>1 and dev<>8 and dev<>9 then 840
- 870 rem use the kernal setlfs
- 880 poke a,0 : poke x,dev : poke y,0
- 890 sys 65466
- 910 rem setup filename
- 920 b$="runscript macros"
- 930 for loop=1 to len(b$)
- 940 poke 849+loop,asc(mid$(b$,loop,1))
- 950 next loop
- 970 rem use kernal setnam
- 980 poke a,len(b$) : poke x,850and255 : poke y,850/256
- 990 sys 65469
- 1010 rem use kernal save
- 1020 poke 253,0 : poke 254,4*16
- 1030 poke a,253 : poke x,ptrand255 : poke y,ptr/256
- 1040 sys 65496
- 1070 end
- 1110 rem input subroutine
- 1130 input a$ : a$=left$(a$,1)
- 1150 if a$="*" then return
- 1160 if a$<"a" then 1130
- 1170 if a$>"[218]" then 1130
- 1180 if a$>"z" and a$<"[193]" then 1130
- 1200 if a$<="z" then macnum=asc(a$)-65
- 1210 if a$>="[193]" then macnum=asc(a$)-167
- 1230 return
-